import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/service_msg_list_entity.dart';

ServiceMsgListEntity $ServiceMsgListEntityFromJson(Map<String, dynamic> json) {
  final ServiceMsgListEntity serviceMsgListEntity = ServiceMsgListEntity();
  final int? code = jsonConvert.convert<int>(json['Code']);
  if (code != null) {
    serviceMsgListEntity.code = code;
  }
  final List<ServiceMsgListData>? data = (json['Data'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<ServiceMsgListData>(e) as ServiceMsgListData)
      .toList();
  if (data != null) {
    serviceMsgListEntity.data = data;
  }
  return serviceMsgListEntity;
}

Map<String, dynamic> $ServiceMsgListEntityToJson(ServiceMsgListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['Code'] = entity.code;
  data['Data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension ServiceMsgListEntityExtension on ServiceMsgListEntity {
  ServiceMsgListEntity copyWith({
    int? code,
    List<ServiceMsgListData>? data,
  }) {
    return ServiceMsgListEntity()
      ..code = code ?? this.code
      ..data = data ?? this.data;
  }
}

ServiceMsgListData $ServiceMsgListDataFromJson(Map<String, dynamic> json) {
  final ServiceMsgListData serviceMsgListData = ServiceMsgListData();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    serviceMsgListData.id = id;
  }
  final String? account = jsonConvert.convert<String>(json['account']);
  if (account != null) {
    serviceMsgListData.account = account;
  }
  final String? nickname = jsonConvert.convert<String>(json['nickname']);
  if (nickname != null) {
    serviceMsgListData.nickname = nickname;
  }
  final String? isRest = jsonConvert.convert<String>(json['is_rest']);
  if (isRest != null) {
    serviceMsgListData.isRest = isRest;
  }
  final String? photo = jsonConvert.convert<String>(json['photo']);
  if (photo != null) {
    serviceMsgListData.photo = photo;
  }
  return serviceMsgListData;
}

Map<String, dynamic> $ServiceMsgListDataToJson(ServiceMsgListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['account'] = entity.account;
  data['nickname'] = entity.nickname;
  data['is_rest'] = entity.isRest;
  data['photo'] = entity.photo;
  return data;
}

extension ServiceMsgListDataExtension on ServiceMsgListData {
  ServiceMsgListData copyWith({
    String? id,
    String? account,
    String? nickname,
    String? isRest,
    String? photo,
  }) {
    return ServiceMsgListData()
      ..id = id ?? this.id
      ..account = account ?? this.account
      ..nickname = nickname ?? this.nickname
      ..isRest = isRest ?? this.isRest
      ..photo = photo ?? this.photo;
  }
}